import skimage.io
import os

def load_train17(Debug=False):
    src_folder = '/media/dell/cb552bf1-c649-4cca-8aca-3c24afca817b/dell/wxm/Data/decsai/GM512/patches17_train'
    img_names = []
    imgs = []
    flag = 0
    for img in os.listdir(src_folder):
        img_path = src_folder + '/' + img
        img_names.append(img)
        img_arr = skimage.io.imread(img_path)
        imgs.append(img_arr)
        flag += 1
        if Debug == True and flag >= 10000:
            break
    return imgs,img_names

def load_val17(Debug=False):
    src_folder = '/media/dell/cb552bf1-c649-4cca-8aca-3c24afca817b/dell/wxm/Data/decsai/GM512/patches17_val'
    img_names = []
    imgs = []
    flag = 0
    for img in os.listdir(src_folder):
        img_path = src_folder + '/' + img
        img_names.append(img)
        img_arr = skimage.io.imread(img_path)
        imgs.append(img_arr)
        flag += 1
        if Debug == True and flag >= 5000:
            break
    return imgs,img_names

def load_train32(Debug=False):
    src_folder = '/media/dell/cb552bf1-c649-4cca-8aca-3c24afca817b/dell/wxm/Data/decsai/GM512/patches32_train'
    img_names = []
    imgs = []
    flag = 0
    for img in os.listdir(src_folder):
        img_path = src_folder + '/' + img
        img_names.append(img)
        img_arr = skimage.io.imread(img_path)
        imgs.append(img_arr)
        flag += 1
        if Debug == True and flag >= 10000:
            break
    return imgs,img_names

def load_val32(Debug=False):
    src_folder = '/media/dell/cb552bf1-c649-4cca-8aca-3c24afca817b/dell/wxm/Data/decsai/GM512/patches32_val'
    img_names = []
    imgs = []
    flag = 0
    for img in os.listdir(src_folder):
        img_path = src_folder + '/' + img
        img_names.append(img)
        img_arr = skimage.io.imread(img_path)
        imgs.append(img_arr)
        flag += 1
        if Debug == True and flag >= 5000:
            break
    return imgs,img_names

def load_train18(Debug=False):
    src_folder = '/media/dell/cb552bf1-c649-4cca-8aca-3c24afca817b/dell/wxm/Data/decsai/GM512/patches18_train'
    img_names = []
    imgs = []
    flag = 0
    for img in os.listdir(src_folder):
        img_path = src_folder + '/' + img
        img_names.append(img)
        img_arr = skimage.io.imread(img_path)
        imgs.append(img_arr)
        flag += 1
        if Debug == True and flag >= 12800:
            break
    return imgs,img_names

def load_val18(Debug=False):
    src_folder = '/media/dell/cb552bf1-c649-4cca-8aca-3c24afca817b/dell/wxm/Data/decsai/GM512/patches18_val'
    img_names = []
    imgs = []
    flag = 0
    for img in os.listdir(src_folder):
        img_path = src_folder + '/' + img
        img_names.append(img)
        img_arr = skimage.io.imread(img_path)
        imgs.append(img_arr)
        flag += 1
        if Debug == True and flag >= 128*40:
            break
    return imgs,img_names

def load_32_crop_to_20(Debug=False):
    src_folder = '/media/dell/cb552bf1-c649-4cca-8aca-3c24afca817b/dell/wxm/Data/decsai/GM512/patches18_val'
    img_names = []
    imgs = []
    flag = 0
    box = (6,6,26,26)
    for img in os.listdir(src_folder):
        img_path = src_folder + '/' + img
        img_names.append(img)
        img_arr = skimage.io.imread(img_path)
        imgs.append(img_arr)
        flag += 1
        if Debug == True and flag >= 128*40:
            break
    return imgs,img_names

def load_train32C(Debug=False):
    src_folder = '/media/dell/cb552bf1-c649-4cca-8aca-3c24afca817b/dell/wxm/Data/decsai/CM512/patches32_train'
    img_names = []
    imgs = []
    flag = 0
    for img in os.listdir(src_folder):
        img_path = src_folder + '/' + img
        img_names.append(img)
        img_arr = skimage.io.imread(img_path)
        imgs.append(img_arr)
        flag += 1
        if Debug == True and flag >= 10000:
            break
    return imgs,img_names

def load_val32C(Debug=False):
    src_folder = '/media/dell/cb552bf1-c649-4cca-8aca-3c24afca817b/dell/wxm/Data/decsai/CM512/patches32_val'
    img_names = []
    imgs = []
    flag = 0
    for img in os.listdir(src_folder):
        img_path = src_folder + '/' + img
        img_names.append(img)
        img_arr = skimage.io.imread(img_path)
        imgs.append(img_arr)
        flag += 1
        if Debug == True and flag >= 5000:
            break
    return imgs,img_names